<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2021/10/22
 * Time: 16:05
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\common\model\mysql;

use app\common\lib\Status;

class Seat extends Base
{
    protected function getGetVenueAttr($value)
    {
        $venue = (new Venue())->getBaseById((int)$value);
        return $venue;
    }

    protected function getGetTheatreCateIdAttr($value)
    {
        $theatre = (new TheatreCate())->getBaseById((int)$value);
        return $theatre;
    }

    /**
     * @param int $venue
     * @param string $field
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getSeatByList(int $venue = 0, string $field = '*')
    {
        return $this->field($field)
            ->where('theatre_cate_id', $venue)
            ->select()
            ->toArray();
    }
}